package pl.edu.agh.student.nn.core;

import java.util.ArrayList;
import java.util.List;

/**
 * 
 * To change this template use File | Settings | File Templates.
 *
 */
public abstract class Neuron {
    protected ActivationFunction activationFunction;
    protected List<Connection> outputConnections = new ArrayList<Connection>();
    
    protected double output;
    protected Layer layer;
    protected double bias = 0;
    protected boolean hasBias;

    //protected List<Connection> oldOutputConnections = new ArrayList<Connection>();
    
    public abstract void calculate();

    public abstract String display();

    /**
     * Zwraca polaczenia neuronu z innymi neuronomi. Polaczenia wy - we
     * @return 
     */
    public List<Connection> getOutputConnections() {
        return outputConnections;
    }

//    public void setOutputConnections(List<Connection> outputConnections) {
//        this.outputConnections = outputConnections;
//        this.oldOutputConnections  = new ArrayList<Connection>();
//        for(Connection c: outputConnections){
//            Connection c1 = new Connection();
//            c1.setFromNeuron(c.getFromNeuron());
//            c1.setToNeuron(c.getToNeuron());
//            c1.setWeight(c.getWeight());
//            
//            this.oldOutputConnections.add(c1);
//        }
//    }
    

    /**
     * Odpowiedz neuronu 
     * @return 
     */
    public double getOutput() {
        return output;
    }

    public void setOutput(double output) {
        this.output = output;
    }

    /** 
     * Zwraca warstwe w ktorej znajduje sie neuron
     * @return 
     */
    public Layer getLayer() {
        return layer;
    }

    public void setLayer(Layer layer) {
        this.layer = layer;
    }
    
    public ActivationFunction getActivationFunction() {
        return activationFunction;
    }

    public void setActivationFunction(ActivationFunction activationFunction) {
        this.activationFunction = activationFunction;
    }

    public double getBias() {
        return bias;
    }

    public void setBias(double bias) {
        this.bias = bias;
    }

    public void isBias(boolean b) {
        hasBias = b;
    }

    public boolean hasBias() {
        return hasBias;
    }
}
